package gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;

import main.Logger;
import main.PlayerStats;

public class Gui extends JPanel {

	public Gui(Guimap gmap, Selection selection, PlayerStats ps, Logger logg) {
		super(new BorderLayout());
		JFrame frame = new JFrame("duper");
		add(gmap, BorderLayout.CENTER);
		
		JPanel bottomPane = new JPanel(new GridLayout(1,2));
		bottomPane.setBackground(Color.YELLOW);
		bottomPane.setPreferredSize(new Dimension(200, 200));
		add(bottomPane, BorderLayout.SOUTH);
		
		SelectionPane selpane = new SelectionPane(selection, ps);
		bottomPane.add(selpane);
		
		ChatPane chatpane = new ChatPane();
		logg.addObserver(chatpane);
		bottomPane.add(chatpane);
		
		JPanel rightpane = new JPanel(new GridLayout(2,1));
		add(rightpane, BorderLayout.EAST);
		
		StatPanel statpane = new StatPanel();
		ps.addObserver(statpane);
		rightpane.add(statpane);
		
		JPanel shoppingpane = new ShoppingPane(selection);
		rightpane.add(shoppingpane);
		
		frame.add(this);
		frame.setVisible(true);
		frame.pack();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	
}
